package com.zero.manage.web.utils.exception;

import io.gitee.zerowsh.util.PublicResult;
import io.gitee.zerowsh.enums.ResultEnums;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;


/**
 * 统一处理404异常
 *
 * @author zero
 */
@RestController
public class NotFoundException implements ErrorController {
    @Override
    public String getErrorPath() {
        return "/error";
    }


    @RequestMapping("/error")
    @ApiIgnore
    public PublicResult error(Exception e) {
        return PublicResult.resultEnums(ResultEnums.NOT_FOUND);
    }

}
